package com.geek.spring.jdbc;

/**
 * @program java-spring
 * @description: main
 * @author: chanzhugang
 * @create: 2021/04/17 23:49
 */
public class JbdcMain {

    public static void main(String[] args) {
        String sql = "CREATE TABLE IF NOT EXISTS `user_info`("
                +"`id` INT UNSIGNED AUTO_INCREMENT,"
                +" `user_name` VARCHAR(100),"
                +" `user_password` VARCHAR(100),"
                +" `age` INT(11),"
                +"PRIMARY KEY ( `id` )"
                +")ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        DBUtil.executeUpdate(sql);

        sql = "INSERT INTO user_info (user_name,user_password,age) VALUES('张三丰','123456',100)";

        DBUtil.executeUpdate(sql);

        sql = "UPDATE user_info SET user_name = '张君宝' where id = 1";
        DBUtil.executeUpdate(sql);

        sql = "select  * from user_info ";
        DBUtil.query(sql);

        sql = "DELETE FROM user_info WHERE id = 1";
        DBUtil.executeUpdate(sql);
    }
}